﻿app.factory('ArtistDetailsFactory', ['$http', '$q', function ($http, $q) {
    var o = {};
    o.artist = {};
    o.artistDetails = [];
    o.getArtistById = function (id) {
        for (var i = 0; i < o.artistdetails.length; i++) {
            if (o.artistdetails[i].ArtistId == id) {
                {
                    return o.artistdetails[i];
                }
            }
        }
    };
    o.GetArtistDetails = function (id) {
        var q = $q.defer();
        var config = { contentType: 'application/json' };

        $http.get('api/apiArtist/' + id, config).success(function (data) {
            o.artist = data;
            q.resolve(data);

        });
        return q.promise;
    };

    return o;
}]);